@extends('admin.layouts.app')
@section('css')
<link href="/admins/vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
@endsection

@section('content')
<div class="">
	<div class="page-title">
		<div class="title_left">
			<h3>微信墙</h3>
		</div>
	</div>

	<div class="clearfix"></div>
	<div class="row">
		<div class="col-md-12 col-sm-12 col-xs-12">
			<div class="x_panel">
				<div class="x_title">
					<h2>编辑微信墙</h2>
					<div class="clearfix"></div>
				</div>
				<div class="x_content">
					<br />
					<form class="form-horizontal form-label-left" action="{{route('wall.update',['id'=>$wall['id']])}}" method="post" enctype="multipart/form-data">
						{{ csrf_field() }}
						{{ method_field('PATCH') }}
						<input type="hidden" name="id" value="{{$wall['id']}}" />
						<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">名称<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="text" name="name" class="form-control" value="{{old('name')?old('name'):$wall['name']}}">
								@if ($errors->has('name'))
								<span class="help-block"> <strong>{{ $errors->first('name') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">标题<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="text" name="title" class="form-control" value="{{old('title')?old('title'):$wall['title']}}">
								@if ($errors->has('title'))
								<span class="help-block"> <strong>{{ $errors->first('title') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group{{ $errors->has('failure_date') ? ' has-error' : '' }}">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">失效日期<span class="required">*</span> </label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input id="failure_date" type="text" name="failure_date" class="date-picker form-control"
									value="{{old('failure_date')?old('failure_date'):$wall['failure_date']}}">
								@if ($errors->has('failure_date'))
								<span class="help-block"> <strong>{{ $errors->first('failure_date') }}</strong> </span>
								@endif
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">背景</label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<input type="file" name="background" class="form-control" >
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3 col-sm-3 col-xs-12">备注</label>
							<div class="col-md-6 col-sm-6 col-xs-12">
								<textarea class="form-control" name="remark" rows="5">{{old('remark')?old('remark'):$wall['remark']}}</textarea>
							</div>
						</div>

						<div class="ln_solid"></div>
						<div class="form-group">
							<div class="col-xs-12 text-center">
								<button type="submit" class="btn btn-success">
								提交
								</button>
							</div>
						</div>

					</form>
				</div>
			</div>
		</div>
	</div>
</div>
@endsection

@section('js')
<script src="/admins/vendors/moment/min/moment.min.js"></script>
<script src="/admins/vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript">
	$(function(){
    		var start = moment();
    		var end = moment().add(7, 'days');

		$('#failure_date').daterangepicker({
			locale: {
		      format: 'YYYY-MM-DD'
		   	},
		   	minDate:start,
		   	maxDate:end,
          	singleDatePicker: true
       });
	})
</script>
@endsection
